Example 1:

Here is a first example, producing a plot for this document. The GNUPLOT input file is given below, and the output appears as Figure [*]. The input file defines the output to be in LATEX, gives a file name for the output, and plots y = sin(x) for x on [- π, π]. To produce the figure, I simply \input{eg1} in a center environment in a figure environment. In following examples, I will enclose the figure in a box to make it look a little better.

    set terminal latex
    set output "eg1.tex"
    plot [-3.14:3.14] sin(x)

Figure: A first example: y = sin(x)
\begin{figure}\begin{center}
%
\input{eg1}
\end{center}
\end{figure}

Note that GNUPLOT has drawn in the axes, labeled the tic marks for us, scaled the y axis automatically, and added a key in the upper-right-hand corner (this may be moved with the set key command, and removed with set nokey).

This is the default line style for the LATEX driver. Because of the limited picture capabilities of LATEX, many dots are required to approximate drawing a solid line. This may overload the memory of many TEX implementations. There are other line types available that draw dotted lines and use much less memory. The EEPIC driver draws solid lines with much less memory usage.